Hi all,
string sTriggerName = "TestTrigger"
string sModuleName = "Trigger Problem Module"
// Delete the module if it already exists
Item I = item sModuleName
if (!null I) {
if (!confirm "About to delete " sModuleName ". OK?") { ack "Abort."; halt }
if (!null module I) close (module I)
delete I
purge I
}
// This problem affects the trigger code itself
Module mod = create (sModuleName, "", "", 1, true)
ModName_ mn = module mod
current = mod
// Install a post open trigger on the module
Trigger T = trigger (sTriggerName, module, post, open, 10, "\npragma stack, 10000000\nprint \"Inside Trigger...\"\n")
if (null T) error "Trigger " sTriggerName " could not be installed!\n"
save mod; close (mod, false)
ack "After creating the module - Look at the memory of DOORS.exe. About to run the trigger."
mod = read(fullName mn, false, true)
ack "Trigger was executed. Look at the memory of DOORS.exe.\n\n" // -
"The trigger stack is kept alive! 40MB of memory are gone.\n" // -
"About to execute the DXL Attribute!"
close (mod)
ack "The module is closed now, but the stack memory of the trigger is leaked!\n\n" // -
"The memory of the trigger DXL should have been freed after closing the module!"
Mathias Mamsch - Thu Mar 28 04:22:44 EDT 2013 |
Re: Bad Memory Leak Bug with triggers - DOORS 8 and 9 affected This code run from the DXL window causes 80mb of wasted space during the ack; but reclaimed afterwards:
I notice 80mb is double the wasted space of the trigger 40mb. I don't notice unclaimed space with a normal trigger, but that's because the default stack size is 4096 which should waste only "16kb" which is hardly noticeable in task manager. Not following your references to "library". I have a massive library and don't see ..err.. notice these leaks. Seems to me the leak is associated with the "pragma stack" commands, not the size of #included files. Does not "stack" represent "depth of function calls" (and specifically not the number of such calls) and really only matters when you have recursion? And if so, since triggers are usually pretty basic, just put "pragma stack, 200" in the triggers? Does this wasted space mean triggers are run in the top context, or something like that? -Louie |
Re: Bad Memory Leak Bug with triggers - DOORS 8 and 9 affected llandale - Thu Mar 28 14:28:14 EDT 2013
I notice 80mb is double the wasted space of the trigger 40mb. I don't notice unclaimed space with a normal trigger, but that's because the default stack size is 4096 which should waste only "16kb" which is hardly noticeable in task manager. Not following your references to "library". I have a massive library and don't see ..err.. notice these leaks. Seems to me the leak is associated with the "pragma stack" commands, not the size of #included files. Does not "stack" represent "depth of function calls" (and specifically not the number of such calls) and really only matters when you have recursion? And if so, since triggers are usually pretty basic, just put "pragma stack, 200" in the triggers? Does this wasted space mean triggers are run in the top context, or something like that? -Louie
The space is wasted every time the trigger is 'interpreted', just before it is run. Short explanation of stack space: int a int b print "Hallo"
#include <big_library_1.inc> #include <big_library_2.inc> // ... #include <big_library_n.inc> int var = call_some_function() if (var != 0) set trigPreConFail
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Bad Memory Leak Bug with triggers - DOORS 8 and 9 affected Mathias Mamsch - Fri Mar 29 04:39:13 EDT 2013
The space is wasted every time the trigger is 'interpreted', just before it is run. Short explanation of stack space: int a int b print "Hallo"
#include <big_library_1.inc> #include <big_library_2.inc> // ... #include <big_library_n.inc> int var = call_some_function() if (var != 0) set trigPreConFail
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
So, do I understand your suggestion correctly here for Triggers:? Instead of having this in a trigger:
And if so, then instead of this Attr-DXL code:
-Louie I have noticed that Attr-DXL is interpreted
That means if you attr-DXL is simply an #include statement, when debugging you have to modify the code and then modify and save the attr-DXL. Simply re-saving is inadequate so I tend to add or remove a space to the end of the #include statement. Thus att-DXL doesn't waste space based on how often it runs. |
Re: Bad Memory Leak Bug with triggers - DOORS 8 and 9 affected llandale - Tue Apr 02 10:05:50 EDT 2013
So, do I understand your suggestion correctly here for Triggers:? Instead of having this in a trigger:
And if so, then instead of this Attr-DXL code:
-Louie I have noticed that Attr-DXL is interpreted
That means if you attr-DXL is simply an #include statement, when debugging you have to modify the code and then modify and save the attr-DXL. Simply re-saving is inadequate so I tend to add or remove a space to the end of the #include statement. Thus att-DXL doesn't waste space based on how often it runs. |